﻿@{
    ViewBag.Title = "Stock";
}

@section scripts
{ 
    <script src="@Url.Content("~/Scripts/shared/share.js")" type="text/javascript"></script> 
    <script src="@Url.Content("~/Scripts/shared/shown.js")" type="text/javascript"></script>
}
    @Html.Partial("~/Views/Modular/ToolBarModify.cshtml")
    @Html.Partial("~/Views/Modular/SearchInfo.cshtml")
    <div class="mini-fit">
        <div id="datagrid1" class="mini-datagrid" style="width:100%;height:100%;" pageSize="15"
                borderStyle="border:1;" url="GetList"
                allowCellSelect="true" allowCellEdit="true"showColumnsMenu="true"fitColumns="false"  
                onrowdblclick="modify"  sortMode="client">
            <div property="columns">
                <div type="checkcolumn" >选行</div>
                <div type="indexcolumn" width="40" headerAlign="center" >序号</div>
                <div field="FNumber" name="FNumber" width="70" headeralign="center" allowsort="true">门店编码</div>
                <div field="FName" name="FName" width="150" headeralign="center" allowsort="true">门店名称</div>
                <div field="FAddress" name="FAddress" width="200" headeralign="center" allowsort="true">门店地址</div>
                <div field="FManage" name="FManage" width="70" headeralign="center" allowsort="true">管理人员</div>
                <div field="FMobileNumber" name="FMobileNumber" width="100" headeralign="center" allowsort="true">手机号码</div>
                <div field="FTelephone" name="FTelephone" width="100" headeralign="center" allowsort="true">电话号码</div>
                <div field="FAcreage" name="FAcreage" width="70" headeralign="center" allowsort="true">门店面积</div>                    
                <div field="FCorpName" name="FCorpName" width="150" headeralign="center" allowsort="true">所属商户</div>
                <div field="FGpbNumber" name="FGpbNumber" width="100" headeralign="center" allowsort="true">价格方案编码</div>
                <div field="FGpbName" name="FGpbName" width="100" headeralign="center" allowsort="true">价格方案名称</div>
                <div field="FChat" name="FChat" width="150" headeralign="center" allowsort="true">接入商户ID</div>
                <div field="FRemark" name="FRemark" width="200" headeralign="center" allowsort="true">备注</div>
            </div>
        </div>
    </div>

<script>
    mini.parse();
    function FormShown() {
        LoadListData();
    }
    function setkeyPress() {
        if (event.keyCode == 13) {
            LoadListData();
        }        
    }

    //加载资料列表
    function LoadListData() {
        var sSystemAppID = parent.window.getSystemAppID();
        var json = "[{";
        json = json + "'FSystemAppID':" + "'" + sSystemAppID + "',";
        json = json + "'search':" + "'" + mini.getbyName("FSearchKey").getValue() + "'";
        json = json + "}]";
        var grid = mini.get("datagrid1");//==
        grid.load({ mjson: json });
    }

    //搜索资料列表
    function search() {
        LoadListData();
    }
    //刷新
    function refresh() {
        mini.getbyName("FSearchKey").setValue('');
        LoadListData();
    }

    //修改资料
    function modify() {
        if (!mini.get("edit").getVisible()) return;
        var grid = mini.get("datagrid1");
        var row = grid.getSelected();
        if (row) {
            mini.open({
                url: "/Stock/StockInfo",
                title: "门店资料", width: 750, height: 410,
                onload: function () {
                    var iframe = this.getIFrameEl();
                    var data = { action: "edit", FItemID: row.FItemID };
                    iframe.contentWindow.SetInfoData(data);
                },
                ondestroy: function (action) {
                    grid.reload();
                }
            });

        } else {
            mini.alert("请选中一条记录");
        }
    }

</script>
